<template>
    <div class="card-wrap">
      <div class="card-col">
        <div class="card">
          <div class="card-title">当日进件数</div>  
          <div class="card-content">{{datas.currentDayApplying}}<span class="unit">/件</span></div>  
          <div class="card-extar">
            <span>昨日进件数：{{datas.yesterdayApplying}}/件</span>
            <span>环比：{{datas.applyingRate}}%</span>  
          </div>  
        </div>
      </div>
      <div class="card-col">
        <div class="card">
          <div class="card-title">当日放款数</div>  
          <div class="card-content">{{datas.currentDayLoan}}<span class="unit">/件</span></div>  
          <div class="card-extar">
            <span>昨日放款数：{{datas.yesterdayLoan}}/件</span>
            <span>放款率：{{datas.loanRate}}%</span>  
          </div>  
        </div>
      </div>
      <div class="card-col">
        <div class="card">
          <div class="card-title">当日退件数</div>  
          <div class="card-content">{{datas.currentDaySendBack}}<span class="unit">/件</span></div>  
          <div class="card-extar">
            <span>昨日退件数：{{datas.yesterdaySendBack}}/件</span>
            <span>退件率：{{datas.sendBackRate}}%</span>  
          </div>  
        </div>
      </div>
      <div class="card-col">
        <div class="card">
          <div class="card-title">当日拒件数</div>  
          <div class="card-content">{{datas.currentDayReject}}<span class="unit">/件</span></div>  
          <div class="card-extar">
            <span>昨日拒件数：{{datas.yesterdayReject}}/件</span>
            <span>拒件率：{{datas.rejectRate}}%</span>  
          </div>  
        </div>
      </div>
    </div>
</template>

<script>
import {dashboardData} from '@/api/dashboard'
import { mapGetters } from 'vuex';

export default {
  name: 'card',
  props: {
    className: {
      type: String,
      default: 'chart'
    },
  },
  data() {
    return {
      datas: {
        applyingRate : 0, //进件同比
        currentDayApplying : 0, //当日进件数
        currentDayLoan : 0, //当日放款数
        currentDayReject : 0, //当日拒件数
        currentDaySendBack : 0, //当日退件数
        loanRate : 0, //放款率
        rejectRate : 0, //拒件率
        sendBackRate : 0, //退件率
        yesterdayApplying : 0, //昨日进件数
        yesterdayLoan : 0, //昨日放款数
        yesterdayReject : 0, //昨日拒件数
        yesterdaySendBack : 0 , //	昨日退件数
      }
    }
  },
  computed: {
    ...mapGetters(['name']),
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      dashboardData()
        .then(res => {
         this.datas = res.data
        })
    }
  }
};
</script>

<style lang="scss" scoped>
  .card-wrap{
       height: 149px;
      padding-left:20px;
      .card-col{
        float: left;
        width: 25%;
        height: 149px;
        padding-right: 20px;
        .card{
          width: 100%;
          height:100%;
          border-radius: 10px;
          color:#fff;
          padding: 10px 20px;
          background:rgb(5, 131, 248);
          box-shadow: 0 3px 4px rgba(0,0,0,.2);
          &-content{
            text-align:center;
            font-size: 30px;
            padding: 18px 0 ;
            .unit{
              font-size: 14px;
            }
          }
          &-extar{
            font-size: 12px;
            span{
              padding-right: 10px;
            }
          }
        }
        &:nth-child(2){
          .card{
            background:#f87505;
          }
        }
        &:nth-child(3){
          .card{
            background:#6fbd07;
          }
        }
        &:nth-child(4){
          .card{
            background:#af5fec;
          }
        }
      }
    }
</style>